package com.ktjy.utils;

import com.ktjy.entity.SysRight;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author lqm
 * @ClassName TreeUtils
 * @description: TODO
 */
public class TreeUtils {


    public static List<SysRight> getChildList(List<SysRight> parentList, String parentCode) {
        List<SysRight> chilrdens= parentList.stream()
                .filter(sysRight -> sysRight.getRightParentCode().equals(parentCode))
                .map(sysRight -> {
                    sysRight.setChildList(getChildList(parentList, sysRight.getRightCode()));
                    return sysRight;
                }).collect(Collectors.toList());
       return chilrdens;
    }


}
